function getTime(num) {
	num = num * 1000;
	let date = new Date(num);

	let y = date.getFullYear();

	let MM = date.getMonth() + 1;

	MM = MM < 10 ? ('0' + MM) : MM; //月补0

	let d = date.getDate();

	d = d < 10 ? ('0' + d) : d; //天补0

	let h = date.getHours();

	h = h < 10 ? ('0' + h) : h; //小时补0

	let m = date.getMinutes();

	m = m < 10 ? ('0' + m) : m; //分钟补0

	let s = date.getSeconds();

	s = s < 10 ? ('0' + s) : s; //秒补0

	return y + '-' + MM + '-' + d + '  ' + h + ':' + m + ':' + s;
}

function getDay(num) {
	num = num * 1000;
	let date = new Date(num);

	let y = date.getFullYear();

	let MM = date.getMonth() + 1;

	MM = MM < 10 ? ('0' + MM) : MM; //月补0

	let d = date.getDate();

	d = d < 10 ? ('0' + d) : d; //天补0

	let h = date.getHours();

	h = h < 10 ? ('0' + h) : h; //小时补0

	let m = date.getMinutes();

	m = m < 10 ? ('0' + m) : m; //分钟补0

	let s = date.getSeconds();

	s = s < 10 ? ('0' + s) : s; //秒补0

	return y + '-' + MM + '-' + d;
}

function getImg(url) {
	 if (!url) {
	 	return '';
	 }  
 
	if (url.indexOf("http") != -1) {
		return url;
	}

	url = uni.getStorageSync('img_url') + url
	
	return url;
}

function getFace(url) {
	if (!url) {
		return '/static/icon/face.png';
	}
	if (url.indexOf("http") != -1) {
		return url;
	}
	url = uni.getStorageSync('img_url') + url
	return url
}
function getlist(val) {
	var list = [];
	if (val) {
		var find = {
			attachment: val,
			type: 'images'
		}
		list.push(find);
	}
 
	return list;
}
// 一定要暴露出去

export default {
	getTime,
	getImg,
	getDay,
	getFace,
	getlist
}